home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #2
/
Monster Media No. 2 (Monster Media)(1994).ISO
/
prog_pas
/
ddplus63.zip
/
EDITTEST.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-09-20
|
6KB
|
165 lines
{--------------------------------------------------------------------------}
{ }
{ Program: EDITTEST }
{ }
{ Purpose: Test the CFGEDITOR unit and demonstrate how procedures can be }
{ "hooked" into an alt-key. }
{ }
{--------------------------------------------------------------------------}
{$V-}
uses doordriv, {We got to use the doordriver unit!}
cfgeditr, {Use CFGEDITR to provide our editor procedures}
crt, {Why not? We always need CRT for something!}
ddscott; {Miscellanious procedures that I use}
var
name,alias,secret_word,quest,alive,weapon,armour,shield:string;
money,hits:word;
{ ^^^^^ The data for our sample player }
{$F+} { <---- Important, we turned on FAR calls because ALTKEYS }
{ needs them to be "hooked" in properly }
procedure SampleEditor;
const
UserEditScreen: templatedef =
(Header: 'Demo of the Configurable Editor';
Headercolor: green;
Titles: (('Name','Alias','Secret Word',
'Hits','Money','Quest',
'','','',
'','','',
'','','',
'','','',
'',''),
('Alive','Weapon','Armour',
'Shield','','',
'','','',
'','','',
'', '','','','','','',''));
DataLength: ((27,27,27,254,254,55,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
(1,15,15,15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
Data: (('','','','','','','','','','','','','','','','','','','',''),
('','','','','','','','','','','','','','','','','','','',''));
Databyte: ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
Dataint: ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
Datalongint: ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
Dataword: ((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),
(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0));
Startx: 1;
Starty: 3;
Normalfore: 4; Inversefore: 15; Inverseback: 2; Titlefore: cyan);
procedure dataToTemplate(var template: templatedef);
begin;
with Template do begin; {This is where you transfer }
data[1,1]:=name; {the users data to the template.}
data[1,2]:=alias;
data[1,3]:=secret_word;
dataword[1,4]:=hits;
dataword[1,5]:=money;
data[1,6]:=quest;
data[2,1]:=alive;
data[2,2]:=weapon;
data[2,3]:=armour;
data[2,4]:=shield;
end;
end;
procedure TemplateToData(var template: templatedef);
begin;
with Template do begin; {This is where you transfer }
name:=data[1,1]; {New, and changed data from the}
alias:=data[1,2]; {Template to the user data }
secret_Word:=data[1,3];
hits:=dataword[1,4];
money:=dataword[1,5];
quest:=data[1,6];
alive:=data[2,1];
weapon:=data[2,2];
armour:=data[2,3];
shield:=data[2,4];
end;
end;
var
s,s2: string;
a,b: integer;
moresave: boolean;
blah: word;
chainout: char;
begin;
repeat;
DataToTemplate(UserEditScreen); {Transfering data to template}
DoEntry(UserEditScreen,chainout); {Allows you to modify the current}
{Data in the template}
TemplateTodata(UserEditScreen); {Transfering template to data}
until (chainout=#45); {Repeat until ALT-X is encountered}
end;
{$F-} {Far Call is now being turned off}
procedure MakeSampleData; {Things would be kind of boring }
begin; {without our sample user }
name:='Derrick Parkhurst';
alias:='Sir Lancalot';
secret_word:='BRAVE';
Hits:=150;
money:=1000;
quest:='To Find The Holy Grail';
Alive:='Y';
weapon:='Excalibor';
armour:='Enchanted Mail';
shield:='Enchanted Shield';
end;
var
s : string;
begin;
INITDOORDRIVER('doordriv.ctl'); {DoorDriver must be initialized }
ALTKEYS['E']:=@SampleEditor; {Here is where we "hook in" the }
{editor procedure. Remember, we }
{had to declare it far. }
New(ALTHELP['E']); {create a help record for ALT-E }
ALTHELP['E']^:='Sample Editor'; {Put some text in our help record}
MakeSampleData; {create a sample used. }
swriteln('Right now, assume this program is a normal door. The following');
swriteln('prompt would represent the normal main menu of your door. Pressing');
swriteln('ALT-E (on the sysop side only) will pop up the configurable editor');
swriteln('for this door. (again, on the sysop side only). The user will be');
swriteln('paused while the sysop is editing');
repeat;
set_foreground(green);
swriteln('');
swrite('Command (?=Help,Q=Quit) ? ');
set_foreground(white);
sread(s);
set_foreground(default_fore);
s:=stu(s);
if s='?' then begin;
set_foreground(cyan);
swriteln('Since this is a test only, we have no help!');
swriteln('just press ALT-E to bring up the sysop side configurable editor');
set_foreground(default_fore);
end;
until s='Q';
end.